#ifndef _FYMODEM_H_
#define _FYMODEM_H_

/**
 * Free YModem implementation.
 *
 * Fredrik Hederstierna 2014
 *
 * This file is in the public domain.
 * You can do whatever you want with it.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 */

#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <stdbool.h>
#include <stdarg.h>
#include "qe_def.h"



/* max length of filename */
#define FYMODEM_FILE_NAME_MAX_LENGTH  (64)

typedef qe_int (*fymodem_getc_func)(qe_uint timeout);
typedef qe_int (*fymodem_putc_func)(char c);
typedef void (*fymodem_flush_func)(void);

void fymodem_set_callback(fymodem_getc_func getc, fymodem_putc_func putc, 
    fymodem_flush_func flush);

/* receive file over ymodem */
qe_int fymodem_receive(qe_u8 *rxdata, qe_size rxsize,
                        char filename[FYMODEM_FILE_NAME_MAX_LENGTH]);

/* send file over ymodem */
qe_int fymodem_send(qe_u8 *txdata,
                     qe_size txsize,
                     const char *filename);

#endif
